//
//  ComparisonSelectCell.m
//  SecondPage
//
//  Created by winston on 13-5-9.
//  Copyright (c) 2013年 winston. All rights reserved.
//

#import "ComparisonSelectCell.h"

@implementation ComparisonSelectCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        keyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 250, 50)];
        [keyLabel setBackgroundColor:[UIColor clearColor]];
        [keyLabel setTextColor:[UIColor blackColor]];
        [keyLabel setTextAlignment:NSTextAlignmentLeft];
        [keyLabel setFont:[UIFont fontWithName:@"Arial" size:15]];
        [self addSubview:keyLabel];
        [keyLabel release];
        
        valueLabel = [[UILabel alloc] initWithFrame:CGRectMake(260, 0, 200, 50)];
        [valueLabel setBackgroundColor:[UIColor clearColor]];
        [valueLabel setTextColor:[UIColor blackColor]];
        [valueLabel setTextAlignment:NSTextAlignmentRight];
        [valueLabel setFont:[UIFont fontWithName:@"Arial" size:15]];
        [self addSubview:valueLabel];
        [valueLabel release];
        
        arrowView = [[UIImageView alloc]initWithFrame:CGRectMake(470 ,20,8.5, 10.5)];
        [arrowView setImage:[UIImage imageNamed:@"AllAuto_Comparison_Arrow.png"]];
        [self addSubview:arrowView];
        [arrowView release];
        
        UIImageView * lineView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 48, 700, 2)];
        [lineView setImage:[UIImage imageNamed:@"AllAuto_Comparison_DotLine.png"]];
        [self addSubview:lineView];
        [lineView release];
    }
    return self;
}


-(void)loadData:(NSDictionary*)data withStyle:(BOOL)isMainTable
{
    [keyLabel setText:[data objectForKey:@"key"]];
    if(isMainTable)
    {
       [valueLabel setText:[data objectForKey:@"value"]];
        [keyLabel setFrame:CGRectMake(0, 0, 100, 50)];
        [valueLabel setFrame:CGRectMake(110, 0, 350, 50)];
    }
    else
    {
        [valueLabel setText:@""];
        [arrowView setHidden:TRUE];
        
        [keyLabel setFrame:CGRectMake(0, 0, 350, 50)];
        [valueLabel setFrame:CGRectMake(0, 0, 0, 0)];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
